Skip to content

Fix crashes caused by regex characters in email signature - #3252

Merged
sosnovsky merged 3 commits into
masterfrom
issue_3232_fix_regex_usage
Aug 11, 2026
Merged

Fix crashes caused by regex characters in email signature#3252
sosnovsky merged 3 commits into
masterfrom
issue_3232_fix_regex_usage

Conversation

@DenBond7

@DenBond7 DenBond7 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

Email signatures were dynamically converted into regular expressions while comparing and replacing draft content.

Signatures containing regex metacharacters, such as unmatched parentheses, could cause a PatternSyntaxException during draft autosave. Similar unsafe regex handling was also present when detecting or replacing Gmail alias signatures.

Solution

  • Treat signatures as literal text when comparing draft content.
  • Escape alias signatures before using them in multiline regex matching.
  • Replace matched signatures by range so replacement characters such as $ and \ remain literal.
  • Extract alias signature matching and replacement into a testable utility.
  • Add regression tests covering signatures with regex metacharacters.

Testing

  • Added unit tests for draft signature removal.
  • Added unit tests for alias signature matching and replacement.

close #3232


Tests (delete all except exactly one):

  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities

@DenBond7
DenBond7 force-pushed the issue_3232_fix_regex_usage branch from cb971b7 to 35d171e Compare August 11, 2026 03:18
Bumps [gradle-wrapper](https://github.com/gradle/gradle) from 9.6.1 to 9.7.0.
- [Release notes](https://github.com/gradle/gradle/releases)
- [Commits](gradle/gradle@v9.6.1...v9.7.0)

---
updated-dependencies:
- dependency-name: gradle-wrapper
  dependency-version: 9.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@DenBond7
DenBond7 marked this pull request as ready for review August 11, 2026 04:10
@DenBond7
DenBond7 requested a review from sosnovsky as a code owner August 11, 2026 04:10

@sosnovsky sosnovsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done 👍

@sosnovsky
sosnovsky merged commit 28e12a9 into master Aug 11, 2026
7 checks passed
@sosnovsky
sosnovsky deleted the issue_3232_fix_regex_usage branch August 11, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App crash upon normally adding file attachment

2 participants